home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Backup, Restoration & File Management
/
SyncBack SE 5.1
/
SyncBackSE_Setup.exe
/
{app}
/
freespace.vbs
< prev
next >
Wrap
Text File
|
2006-08-14
|
1KB
|
31 lines
'
' Example script to display a message dialog box if the free
' disk space on one or more drives is below a certain leve;
'
' You must pass the drive to check as a command line parameter.
' For example:
'
' FreeSpace.vbs C:
'
' IMPORTANT: The drive letter must be in that format, e.g. C:\
' will fail. It must be drive letter followed by a colon only.
'
const MBFREESPACEREQUIRED = 10 ' !!! Change as appropriate - this is in MBytes
const ONEMB = 1048576
Set objArgs = WScript.Arguments
If (objArgs.Count < 1) then
WScript.Echo "No filename or dirname to copy was supplied."
else
Set objWMIService = GetObject("winmgmts:")
For I = 0 To objArgs.Count - 1
Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='" & objArgs.Item(i) & "'")
if objLogicalDisk.FreeSpace / ONEMB < MBFREESPACEREQUIRED then
MsgBox ("There is less than " & MBFREESPACEREQUIRED & "MBytes of free disk space available on " & objArgs.Item(i))
' Wscript.Echo "There is less than " & MBFREESPACEREQUIRED & "MBytes of free disk space available on " & objArgs.Item(i)
WScript.Quit(1)
end if
Next
end if
WScript.Quit(0)